package com._23DesignPattern._create.Singleton;

/**
 * @Author: huangya
 * @Date: 2019/3/2
 * @Description: 枚举单例
 */
public class SingletonDemo2 {

    SingletonDemo2(){
        InnerEnum.INSTANCE.getInstance();
    }

    enum InnerEnum{

        INSTANCE;

        InnerEnum(){

        }

        private SingletonDemo2 singletonDemo2;

        public SingletonDemo2 getSingletonDemo2() {
            return singletonDemo2;
        }

        public void setSingletonDemo2(SingletonDemo2 singletonDemo2) {
            this.singletonDemo2 = singletonDemo2;
        }


        public SingletonDemo2 getInstance(){
            return new SingletonDemo2();
        }
    }

}
